package com.gupao.bio;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.net.Socket;

/**
 * @基本功能:
 * @program:gupao-netty
 * @author: jiawy
 * @create:2024-10-10 18:07:04
 **/
public class BlockingClientTest {


    public static void main(String[] args) throws Exception {

        Socket sock = new Socket("localhost",8080);

        BufferedWriter bufferedWriter = new BufferedWriter(new java.io.OutputStreamWriter(sock.getOutputStream()));
        bufferedWriter.write("nihaoa  ! \n");
        bufferedWriter.flush();

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(sock.getInputStream()));
        System.out.println("服务端恢复信息："+ bufferedReader.readLine());

    }
}